﻿
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace SIG.Model.Mapping
{ 
    public class ProductPhotoMap : EntityTypeConfiguration<ProductPhoto>
    {
        public ProductPhotoMap()
        {
            this.HasKey(c => c.Id);

            this.Property(p => p.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.ToTable("ProductPhotoSet");

         //   this.Property(p => p.Title).HasMaxLength(50).IsRequired();
            this.Property(p => p.Importance).IsRequired();
            this.Property(p => p.ProductId).IsRequired();

            this.Property(p => p.ImgURL).HasMaxLength(150);
           

            this.HasRequired(p => p.Product).WithMany(h => h.ProductPhotoes).HasForeignKey(p => p.ProductId);
        }
    }
}
